﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Bussiness;

namespace WebApplication.Admin.Baocao
{
    public class BaoCaoXuatnhohonNhap
    {
        public IQueryable<BaoCaoSSNhapXuat> GetNhapssXuat(int gianhap,string ngay,string mamh,int thang,int nam)
        {
            var db = dataprovider.Entity.CHITIETHOADONXUATs;
            return db.Where(p => p.GIATIEN < gianhap && p.MAMH==mamh && p.HOADONXUAT.NGAYXUAT.Value.Month==thang && p.HOADONXUAT.NGAYXUAT.Value.Year==nam)
                .Select(p => new BaoCaoSSNhapXuat 
                { 
                    mathang=p.MATHANG.TENMH,
                    gianhap=gianhap,
                    giaxuat=(int)p.GIATIEN,
                    sonhohon=gianhap -(int)p.GIATIEN,
                    soluong=(int)p.SOLUONGXUAT,
                    ngay=ngay
                });
        }
        public class BaoCaoSSNhapXuat
        {
            public String mathang { get; set; }
            public int gianhap { get; set; }
            public int giaxuat { get; set; }
            public int sonhohon { get; set; }
            public int soluong { get; set; }
            public string ngay { get; set; }
        }
    }
}